TypeScript 98.3%
CSS 0.9%
Shell 0.7%
1import { Suspense } from "react";2import { notFound } from "next/navigation";3import { requireUser } from "@/lib/auth/session.ts";4import { all, get } from "@/lib/db/index.ts";5import { ChatApp } from "@/components/chat/chat-app";67export const metadata = { title: "Chat" };89export default async function ChatConversationPage(ctx: { params: Promise<{ id: string }> }) {10 const user = await requireUser();11 const id = parseInt((await ctx.params).id, 10);12 const conv = get("SELECT id FROM conversations WHERE id = ? AND user_id = ?", id, user.id);13 if (!conv) notFound();14 const courses = all<{ code: string; title: string; color: string }>(15 `SELECT c.code, c.title, c.color FROM courses c JOIN enrollments e ON e.course_code = c.code16 WHERE e.user_id = ? AND c.active = 1 ORDER BY c.code`,17 user.id18 );19 return (20 <Suspense>21 <ChatApp courses={courses} initialConversationId={id} />22 </Suspense>23 );24}25